{% extends "master.html" %}

{% block title %}Хувийн мэдээллийг оруулах{% endblock %}

{% block script %}
<script type="text/javascript">
function saveProfile()
{
	document.forms['save_profile'].submit();
}
</script>
{% endblock %}

{% block content %}
	{% if user %}
		<table align="center">
			<tbody>
				<tr>
					<td><center><strong><p>Хувийн мэдээллийг оруулах</p></strong></center></td>
				</tr>
			</tbody>
		</table>
		<form name="save_profile" method="POST">
			<table align="center">
				<tbody>
					<tr>
						<td>Нэр: </td>
						<td><input type="text" name="firstname" value="{{ chosen_account.firstname }}" /></td>
					</tr>
					<tr>
						<td>Овог: </td>
						<td><input type="text" name="lastname" value="{{ chosen_account.lastname }}" /></td>
					</tr>
					<tr>
						<td>Хүйс: </td>
						<td>
							{% for gender in gender_list %}
								{% ifequal chosen_account.gender.gender gender.gender %}
									<label><input type="radio" name="chosen_gender" value="{{ gender.gender }}" checked />{{ gender.gender }}</label>
								{% else %}
									<label><input type="radio" name="chosen_gender" value="{{ gender.gender }}" />{{ gender.gender }}</label>
								{% endifequal %}
							{% endfor %}
						</td>
					</tr>
					<tr>
						<td>Төрсөн огноо: </td>
						<td>
							<select name="year">
								<option></option>
								{% for year in year_list%}
									{% ifequal chosen_account.birthdate.year year %}
										<option selected>{{ year }}</option>
									{% else %}
										<option>{{ year }}</option>
									{% endifequal %}
								{% endfor %}
							</select> оны
							<select name="month">
								<option></option>
								{% for month in month_list %}
									{% ifequal chosen_account.birthdate.month month %}
										<option selected>{{ month }}</option>
									{% else %}
										<option>{{ month }}</option>
									{% endifequal %}
								{% endfor %}
							</select> сарын
							<select name="day">
								<option></option>
								{% for day in day_list %}
									{% ifequal chosen_account.birthdate.day day %}
										<option selected>{{ day }}</option>
									{% else %}
										<option>{{ day }}</option>
									{% endifequal %}
								{% endfor %}
							</select>
						</td>
					</tr>
					<tr>
						<td>Утас: </td>
						<td><input type="text" name="phone" value="{{ chosen_account.phone }}" /></td>
					</tr>
					<tr>
						<td>И-мэйл: </td>
						<td><input type="text" name="email" value="{{ chosen_account.email }}" /></td>
					</tr>
					<tr>
						<td>Улс: </td>
						<td><input type="text" name="country" value="{{ chosen_account.country }}" /></td>
					</tr>
					<tr>
						<td>Хот: </td>
						<td><input type="text" name="city" value="{{ chosen_account.city }}" /></td>
					</tr>
					<tr>
						<td>Хаяг: </td>
						<td><textarea name="address">{{ chosen_account.address }}</textarea></td>
					</tr>
					<tr>
						<td>Шуудан: </td>
						<td><textarea name="postal">{{ chosen_account.postal }}</textarea></td>
					</tr>
					<tr>
						<td>Ажил мэргэжил: </td>
						<td>
							<select name="chosen_occupation">
								<option></option>
								{% for occupation in occupation_list %}
									{% ifequal chosen_account.occupation.occupation occupation.occupation %}
										<option selected>{{ occupation.occupation }}</option>
									{% else %}
										<option>{{ occupation.occupation }}</option>
									{% endifequal %}
								{% endfor %}
							</select>
						</td>
					</tr>
					<tr>
						<td></td>
						<td>
							<input type="button" value="Хадгалах" onclick="saveProfile()" />
							<input type="button" value="Буцах" onclick="history.go(-1)" />
							<input type="hidden" name="chosen_account" value="{{ chosen_account.key.id }}" />
						</td>
					</tr>
				</tbody>
			</table>
		</form>
	{% endif %}
{% endblock %}

{% block sidebar %}{% include "sidebar.html" %}{% endblock %}